<!DOCTYPE html>

<html>
<head>
    <meta charset="UTF-8">
    <title>景点页</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
        }
		img {
			height: 200px;
		}
        header {
            background-color: #4A38AA;
            color: #9A983C;
            padding: 20px;
            text-align: center;
        }
        h1 {
            margin: 0;
            font-size: 36px;
            font-weight: normal;
        }
		
		
        main {
            padding: 20px;
            max-width: 800px;
            margin: 0 auto;
        }
		a {
			background-color: aquamarine;
		}
        .product {
            display: flex;
            margin-bottom: 20px;
            border: 1px solid #CCC;
            padding: 10px;
            border-radius: 5px;
            box-shadow: 0 0 5px rgba(0,0,0,0.2);
        }
	
        .product img {
            width: 200px;
            margin-right: 20px;
        }
        .product h2 {
            margin: 0;
            font-size: 24px;
        }
		
        .product p {
            margin: 0 0 10px 0;
            font-size: 18px;
        }
        
        footer {
            background-color: #EEE;
            padding: 20px;
            text-align: center;
        }

		#sense_comment {
  			width: 700px; /* 调整为您想要的宽度 */
		}
    </style>
</head>
	
<body>
	 <?php  
$sense_name = $_GET['sense_name'];
include("connection.php"); 
?>
	    <header> 
        <p><?php echo $sense_name ?></p>
    </header>
	<nav class="nav">
      <ul>
        <li><a href="sense.php">景点</a></li>
		<li><a href="shop.php">商品</a></li>
	  </ul>
    </nav>
    <main>
        <div class="product">
            <div>
<?php
// 获取上一个页面传递的sense_name
$sense_name = $_GET['sense_name'];

include("connection.php");
session_start();
$_SESSION['sense_name'] = $sense_name;
// 查询sense表并获取sense_information
 $city = $_GET['sense_city'];			
	$sql = "SELECT sense_information FROM sense WHERE sense_name = '$sense_name'";
	$queryresult = mysqli_query($connection,$sql);
	$row = mysqli_fetch_assoc($queryresult);
	$rows = mysqli_fetch_row($queryresult);
	$rownum = mysqli_num_rows($queryresult);
				foreach ($queryresult as $row){
					echo '<h2>'.$row["sense_information"].'</h2>';
			}
	
?>
            </div>
        </div>
    </main>
    
</body>
	<body>

		
    <main>
        <div class="product">
            <div>
				<header> 
        <h2>评论区&nbsp;</h2>
    </header>
<?php
// 获取上一个页面传递的sense_name
$sense_name = $_GET['sense_name'];
include("connection.php");
session_start();

// 查询sense表并获取sense_information			
	$sql = "SELECT * FROM comment WHERE sense_name = '$sense_name'";
	$queryresult = mysqli_query($connection,$sql);
	$row = mysqli_fetch_assoc($queryresult);
	$rows = mysqli_fetch_row($queryresult);
	$rownum = mysqli_num_rows($queryresult);
				foreach ($queryresult as $row){
					echo '<h2>'.$row['userid'].":".'<h2>';
					
					echo '<h2>'.$row["sense_comment"].'</h2>';
			}
	
?>
            </div>
        </div>
    </main>
     <main>
        <div class="product">
            <div>
			


<input type="text" id="sense_comment" name="sense_comment" placeholder="写下你的评论吧" required>

<button onclick="submitForm()">提交</button>

<script>
function submitForm() {
  var senseComment = document.getElementById("sense_comment").value;
  var senseName = "<?php echo $sense_name; ?>";
  var url = "add_comment.php?sense_comment=" + encodeURIComponent(senseComment) + "&sense_name=" + encodeURIComponent(senseName);
  window.location.href = url;
}
</script>
	

            </div>
        </div>
    </main>
</body>
			
</html>